package com.mikey.io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;

/**
 * @author :Mikey
 * @description :带缓冲区的字符读写
 * @create :2022-10-31 10:27:00
 */
public class BufferedDemo {
    public static void main(String[] args) throws Exception {
        FileReader fileReader = new FileReader("D:\\demo\\a.txt");
        FileWriter fileWriter = new FileWriter("D:\\demo\\b.txt");
        char[] chars = new char[100];
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
//        String s = null;
//        while ((s=bufferedReader.readLine())!=null){
//            bufferedWriter.write(s);
//            bufferedWriter.newLine();
//        }
        int read = bufferedReader.read(chars);
        System.out.println(chars);
        bufferedReader.close();
        bufferedWriter.close();
        System.out.println("success!");
    }
}
